//package com.baizhi.filter;
//
//import javax.servlet.*;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//
///**
// * 1.实现过滤器接口  Filter  javax.servlet.Filter
// * 2.实现接口中方法
// */
//public class AdminFilter implements Filter {
//
//    /**
//     * doFilter 什么用？
//     * 拦截请求 在方法中可以做一些处理 决定要不要放行请求
//     */
//    @Override
//    public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
//        System.out.println("进入过滤器");
//        HttpServletRequest request = (HttpServletRequest) req;
//        HttpServletResponse response = (HttpServletResponse) res;
//
//        System.out.println(request.getRequestURI());
////        强制登录校验session
//        Object admin = request.getSession().getAttribute("admin");
//        String contextPath = request.getContextPath();
//        System.out.println("admin："+admin);
////
////        if (admin==null){
//////            重定向到login.jsp
////            response.sendRedirect(contextPath+"/login.jsp");
////        }else {
//////            放行请求
////            chain.doFilter(req,res);
////        }
//
//    }
//}
